// --------------------------------------------------------------------
//   name 	: 
//   desc 	: 
//   version 	: 
//   dev 	: 
// --------------------------------------------------------------------
// DEPENDENCIES
// 
// --------------------------------------------------------------------
// CHANGE HISTORY
// 0.1 	Initial Release
// --------------------------------------------------------------------
	plugins.gameAlert = { // Alerts from the TWE staff
		'enhance_game_overview_villages' : function() {

			host = 'http://tribalwarsenhancerbeta.googlecode.com/svn/trunk/update.txt';
			time = parseInt(new Date().getTime().toString().substring(0, 10)); // unix time

			var lastupdate = getValueGlobal("alertupdate");

			if (typeof lastupdate != 'object') {lastupdate = [0,0];}

			if ((lastupdate[0]+3600) < time) {

				setValueGlobal("alertupdate", [time, lastupdate[1]]);

				$("body").append('<div id="alertupdate">Checking for updates..</div>');

				GM_xmlhttpRequest({method: 'GET',
						url: host+'?'+time,
						onload: function(xhr) {
							var update = xhr.responseText.match(/update=([^ ]+)/g);
							update = update[0].replace(/update=/g, "");
							
							if (parseInt(update) > lastupdate[1]) {
								setValueGlobal("alertupdate", [time, parseInt(update)]);
								
								setFunc("closeinfo", function() {
									$("#staffinfo").remove();
								});
								$("#alertupdate").remove();
								$("body").append(xhr.responseText);
											
							} else {
								$("#alertupdate").remove();
							}
						}
					});
			}
		},
		'info' : {
		'mandatory' : false,
		'name' : "Alerts from the TWE crew",
		'desc' : "Alerts from the TWE crew that let you know about updates and other important things. We wont spam you, we promise!",
		'version' : "0.1",
		'dev' : "Timas"
		}
		
	};
